package com.edvinli.controller;

import com.edvinli.entity.ClazzCountOption;
import com.edvinli.entity.JobOption;
import com.edvinli.entity.Result;
import com.edvinli.entity.StudentDegreeOption;
import com.edvinli.service.ReportService;
import com.edvinli.service.impl.ReportServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
public class ReportController {

    @Autowired
    private ReportService reportService;
    /**
     * 统计各职位员工人数
     * @return
     */
    @GetMapping("/report/empJobData")
    public Result empJobData(){
        log.info("统计职位和人数");
        JobOption jobOption = reportService.empJobData();

        return Result.success(jobOption);
    }

    /**
     * 统计员工性别数据
     * @return
     */
    @GetMapping("/report/empGenderData")
    public Result getEmpGenderData(){
        log.info("拿到员工性别的数据");
        List<Map> list = reportService.getEmpGenderData();

        return Result.success(list);
    }

    /**
     * 统计班级人数数据
     * @return
     */
    @GetMapping("/report/studentCountData")
    public Result getStudentCountData(){
        log.info("拿到班级人数的数据");
        ClazzCountOption clazzCountOption = reportService.getStudentCountData();

        return Result.success(clazzCountOption);
    }

    /**
     * 统计学历人数
     * @return
     */
    @GetMapping("/report/studentDegreeData")
    public Result getStudentDegree(){
        log.info("学员学历统计");
        List<Map> map = reportService.getStudentDegree();

        return Result.success(map);
    }
}
